import DS from 'ember-data';
import BaseModel from './base-model';

export default BaseModel.extend({
  dateService: Ember.inject.service("date-service"),
  lastUpdateUser:DS.belongsTo('user'),//更新操作者userid
  createUser:DS.belongsTo('user'),//创建者
  createDateTime:DS.attr('number'),//创建时间
  customer:DS.attr('customer'),//创建用户
  name:DS.attr('string'),//员工姓名
  idcard:DS.attr('string'),//保存用户身份证
  staffStatus:DS.belongsTo('dicttype'),//在职状态
  onjobDate:DS.attr('number'),//入职日期
  regularDate:DS.attr('number'),//转正日期
  leaveDate:DS.attr('number'),//离职日期
  probationAmount:DS.attr('number'),//试用工资
  regularAmount:DS.attr('number'),//转正工资
  baseAmount:DS.attr('number'),//岗位工资（基本工资）
  bonusAmount:DS.attr('number'),//绩效奖金
  cutAmount:DS.attr('number'),//绩效扣款
  otherAmount:DS.attr('number'),//其它金额
  leaveDays:DS.attr('number'),//请假天数（不带薪请假天数）
  salaryReport:DS.belongsTo('salaryreport'),//所属于哪个月

  createDateTimeStr:Ember.computed("createDateTime",function(){
    var createDateTime = this.get("createDateTime");
    return createDateTime ? this.get("dateService").formatDate(createDateTime,"yyyy-MM-dd hh:mm") : '';
  }),

  onjobDateStr:Ember.computed("onjobDate",function(){
    var onjobDate = this.get("onjobDate");
    return onjobDate ? this.get("dateService").formatDate(onjobDate,"yyyy-MM-dd") : '——';
  }),

  regularDateStr:Ember.computed("regularDate",function(){
    var regularDate = this.get("regularDate");
    return regularDate ? this.get("dateService").formatDate(regularDate,"yyyy-MM-dd") : '——';
  }),

  leaveDateStr:Ember.computed("leaveDate",function(){
    var leaveDate = this.get("leaveDate");
    return leaveDate ? this.get("dateService").formatDate(leaveDate,"yyyy-MM-dd") : '——';
  }),

});
